

CXX := g++
CXXFLAGS := -Wall

ifdef DEBUG
 CXXFLAGS += -DDEBUG
endif


directory_name := ${notdir ${abspath .}}
library_file := lib${directory_name}.a

# 编译静态库（这个是默认目标）
.PHONY : static_library
static_library : ${library_file}


# 编译测试程序
.PHONY : test
test : test.exe

# 对象文件
objects = FileOperation.o FilePath.o

test.exe : test.o libFileLibrary.a
	g++ test.o -o $@ -L . -lFileLibrary

${library_file} : ${objects}
	ar cqs $@ $^

test.o : test.cpp
	${CXX} -c $< -o $@ ${CXXFLAGS}

# 统一编译
${objects} : %.o : %.cpp %.h
	${CXX} -c $< -o $@ ${CXXFLAGS}

.PHONY : clean
clean :
	rm -rf *.o *.a *.exe
